﻿using System;
using System.Collections.Generic;

namespace Luna.Connectors.ZohoCRM
{
    [ModuleName("Accounts")]
    public sealed class ZohoAccount : ZohoEntity
    {
        internal static class Fields
        {
            public const string AccountId = "ACCOUNTID";
            public const string AccountName = "Account Name";
            public const string AccountNumber = "Account Number";
            public const string AccountOwner = "Account Owner";
            public const string ParentAccount = "Parent Account";
            public const string AccountType = "Account Type";
            public const string AccountSite = "Account Site";
            public const string Phone = "Phone";
            public const string BillingStreet = "Billing Street";
            public const string BillingCity = "Billing City";
            public const string BillingState = "Billing State";
            public const string BillingCountry = "Billing Country";
            public const string BillingCode = "Billing Code";
            public const string ShippingStreet = "Shipping Street";
            public const string ShippingCity = "Shipping City";
            public const string ShippingState = "Shipping State";
            public const string ShippingCountry = "Shipping Country";
            public const string ShippingCode = "Shipping Code";
            public const string Emplyees = "Employees";
            public const string Ownership = "Ownership";
            public const string Website = "Website";

            public static readonly IEnumerable<string> All = new[] {
            AccountName,
            AccountNumber,
            AccountOwner,
            ParentAccount,
            AccountType,
            AccountSite,
            Phone,
            BillingStreet,
            BillingCity,
            BillingState,
            BillingCountry,
            BillingCode,
            ShippingStreet,
            ShippingCity,
            ShippingState,
            ShippingCountry,
            ShippingCode,
            Emplyees,
            Ownership,
            Website
        };
        }

        internal ZohoAccount()
        {
        }

        public ZohoAccount(string accountName)
        {
            if (accountName == null)
                throw new ArgumentNullException("accountName");

            Name = accountName;
        }

        protected override string IdFieldName
        {
            get { return Fields.AccountId; }
        }

        public string Name
        {
            get { return GetString(Fields.AccountName); }
            private set { SetValue(Fields.AccountName, value); }
        }

        public string Number
        {
            get { return GetString(Fields.AccountNumber); }
            set { SetValue(Fields.AccountNumber, value); }
        }

        public string Owner
        {
            get { return GetString(Fields.AccountOwner); }
            set { SetValue(Fields.AccountOwner, value); }
        }

        public string ParentAccount
        {
            get { return GetString(Fields.ParentAccount); }
            set { SetValue(Fields.ParentAccount, value); }
        }

        public string Type
        {
            get { return GetString(Fields.AccountType); }
            set { SetValue(Fields.AccountType, value); }
        }

        public string Site
        {
            get { return GetString(Fields.AccountSite); }
            set { SetValue(Fields.AccountSite, value); }
        }

        public string PhoneNumber
        {
            get { return GetString(Fields.Phone); }
            set { SetValue(Fields.Phone, value); }
        }

        public string BillingStreet
        {
            get { return GetString(Fields.BillingStreet); }
            set { SetValue(Fields.BillingStreet, value); }
        }

        public string BillingCity
        {
            get { return GetString(Fields.BillingCity); }
            set { SetValue(Fields.BillingCity, value); }
        }

        public string BillingState
        {
            get { return GetString(Fields.BillingState); }
            set { SetValue(Fields.BillingState, value); }
        }

        public string BillingCountry
        {
            get { return GetString(Fields.BillingCountry); }
            set { SetValue(Fields.BillingCountry, value); }
        }

        public string BillingZipCode
        {
            get { return GetString(Fields.BillingCode); }
            set { SetValue(Fields.BillingCode, value); }
        }

        public string ShippingStreet
        {
            get { return GetString(Fields.ShippingStreet); }
            set { SetValue(Fields.ShippingStreet, value); }
        }

        public string ShippingCity
        {
            get { return GetString(Fields.ShippingCity); }
            set { SetValue(Fields.ShippingCity, value); }
        }

        public string ShippingState
        {
            get { return GetString(Fields.BillingState); }
            set { SetValue(Fields.BillingState, value); }
        }

        public string ShippingCountry
        {
            get { return GetString(Fields.ShippingCountry); }
            set { SetValue(Fields.ShippingCountry, value); }
        }

        public string ShippingZipCode
        {
            get { return GetString(Fields.ShippingCode); }
            set { SetValue(Fields.ShippingCode, value); }
        }

        public int Employees
        {
            get { return GetInt32(Fields.Emplyees); }
            set { SetValue(Fields.Emplyees, value); }
        }

        public string Ownership
        {
            get { return GetString(Fields.Ownership); }
            set { SetValue(Fields.Ownership, value); }
        }

        public string Website
        {
            get { return GetString(Fields.Website); }
            set { SetValue(Fields.Website, value); }
        }
    }
}